package dojo.bowling;

public class Bowling {

	Frame[] frames;

	public Bowling(Frame... frames) {

		for (int i = 0; i < frames.length; i++) {

			Frame frame = frames[i];
			if (i + 1 != frames.length) {
				Frame nextFrame = frames[i + 1];
				frame.setNextFrame(nextFrame);
			}

		}
		this.frames = frames;
	}

	public Integer score() {
		int score = 0;
		for (Frame frame : this.frames) {
			score += frame.getScore();

		}

		return score;
	}
}
